package crmdna.payment.ipn;

import java.io.IOException;
import java.util.logging.Logger;

import javax.servlet.http.*;

@SuppressWarnings("serial")
public class IpnServlet extends HttpServlet {
	
	private Logger logger = Logger.getLogger(IpnServlet.class.getName());

	public void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		
		try {
			IpnHandler handler = new IpnHandler();
			handler.setLogger(logger);
			
			IpnConfig config = new IpnConfig("https://www.paypal.com/cgi-bin/webscr", "finance@bhairaviyoga.sg", "", "");
		    handler.setIpnConfig(config);
		    
		    IpnInfoService service = new IpnInfoService();
		    handler.setIpnInfoService(service);
		    
			handler.handleIpn(req);
		}
		catch (Exception ex) {
			logger.info("Exception occured: " + ex.toString());
		}		
	}
}
